package com.yhy.common.security.constant;

/**
 *
 */
public interface SecurityConstants extends com.yhy.common.core.constant.SecurityConstants {

    String OAUTH_TABLE_NAME = "sys_auth_client";
    String CLIENT_FIELDS_FOR_UPDATE = "resource_ids, scope, " + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, " + "refresh_token_validity, additional_information, autoapprove";
    String CLIENT_FIELDS = "client_secret, " + CLIENT_FIELDS_FOR_UPDATE;
    String DEFAULT_INSERT_STATEMENT = "insert into " + OAUTH_TABLE_NAME + " (" + CLIENT_FIELDS + ", client_id) values (?,?,?,?,?,?,?,?,?,?,?)";
    String CLIENT_FIELDS_SELECT = "CONCAT('{noop}',client_secret) as client_secret, " + CLIENT_FIELDS_FOR_UPDATE;
    String BASE_FIND_STATEMENT = "select client_id, " + CLIENT_FIELDS_SELECT + " from " + OAUTH_TABLE_NAME;
    String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";
    String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where is_deleted = 0 and client_id = ?";
    String DEFAULT_UPDATE_STATEMENT = "update " + OAUTH_TABLE_NAME + " " + "set " + CLIENT_FIELDS_FOR_UPDATE.replaceAll(", ", "=?, ") + "=? where client_id = ?";
    String DEFAULT_UPDATE_SECRET_STATEMENT = "update " + OAUTH_TABLE_NAME + " " + "set client_secret = ? where client_id = ?";
    String DEFAULT_DELETE_STATEMENT = "delete from " + OAUTH_TABLE_NAME + " where client_id = ?";

    /**
     * 超管角色code
     */
    String ROOT_ROLE_CODE = "root";
    /**
     * 在线用户jti
     */
    String CACHE_REDIS_ONLINE_USER = "online:user:";
    /**
     * 接口权限前缀
     * <p>
     * {
     * "ips": [],
     * "roles": [
     * "admin",
     * "guest"
     * ]
     * }
     * </p>
     */
    String CACHE_URL_PERM_ROLES_KEY = "system:perm_roles_rule:url";
    /**
     * [{按钮权限:[角色编码]},...]
     */
    String CACHE_BTN_PERM_ROLES_KEY = "system:perm_roles_rule:btn";
    /**
     * 黑名单ip 前缀
     */
    String CACHE_BLACK_LIST_IPS = "black-list-ips:";

}
